Main Page   Modules   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

dePlugins_priv.hpp

Go to the documentation of this file.
00001 ///////////////////////////////////////////////////////////////////////////////
00002 /// @file dePlugins_priv.hpp
00003 ///
00004 /// @brief private plugin header
00005 ///
00006 /// @author Lightning
00007 ///
00008 /// This file is the intellectual property of Novus Delta, LLC.. Usage of the
00009 /// contents of this file is subject to the Destiny3D Member License which
00010 /// can be found at http://www.destiny3d.com.  Any other usage is prohibited.
00011 ///
00012 /// This file is distributed "AS IS" without warranty of any kind.  Novus
00013 /// Delta, LLC. does not guarantee the fitness of the contents of this file
00014 /// for any particular purpose.
00015 ///
00016 /// Copyright (C) 2001-2003 Novus Delta, LLC. All Rights Reserved.
00017 ///
00018 /// <hr>
00019 ///                                 Change History
00020 /// <hr>
00021 ///
00022 /// @date Jun 2003
00023 /// @author Lightning
00024 /// @remarks Creation
00025 ///
00026 ///////////////////////////////////////////////////////////////////////////////
00027 
00028 #ifndef DE_PLUGIN_PRIV_HPP
00029 #define DE_PLUGIN_PRIV_HPP
00030 
00031 #include "deGlobalTypes.hpp"
00032 #include "deByteOrder.hpp"
00033 #include "dePlugins.hpp"
00034 
00035 //-------------------------------------------
00036 // Classes Declared
00037 //-------------------------------------------
00038 class IdePlugin;
00039 class IdePluginTwofish;
00040 class IdePluginRijndael;
00041 class IdePluginZLib;
00042 
00043 //the base class for plugins
00044 class dePlugin
00045 {
00046     protected:
00047         dePlugin();
00048         virtual ~dePlugin();
00049         
00050     public:
00051         //get the interface for a class
00052         void* GetInterface(IdePlugin::interface_t i);
00053 
00054         //release a plugin
00055         int Release();
00056 
00057         //the basic interface functions for the data manipulation
00058         //buffer/length = input
00059         //newbuffer/newlength = new output, newlength is set to the length of the new buffer
00060         //it is updated to the actual written length
00061         virtual deBoolean EncodeData(void *Buffer, DWORD Length, void *NewBuffer, DWORD *NewLength) = 0;
00062         virtual deBoolean DecodeData(void *Buffer, DWORD Length, void *NewBuffer, DWORD *NewLength) = 0;
00063 
00064         //get the maximum size needed for a buffer
00065         virtual DWORD MaxEncodeLength(DWORD Length) = 0;
00066         virtual DWORD MaxDecodeLength(void *Buffer) = 0;
00067 
00068         //other functions are likely to exist to set individual settings for a plugin
00069 };
00070 
00071 class dePluginTwofish : public dePlugin, public IdePluginTwofish
00072 {
00073     public:
00074         //constructor/destructor
00075         dePluginTwofish();
00076         ~dePluginTwofish();
00077 
00078         //get the interface for a class
00079         void* GetInterface(IdePlugin::interface_t i);
00080 
00081         //release a plugin
00082         int Release();
00083 
00084         //the actual functions that do the work
00085         deBoolean EncodeData(void *Buffer, DWORD Length, void *NewBuffer, DWORD *NewLength);
00086         deBoolean DecodeData(void *Buffer, DWORD Length, void *NewBuffer, DWORD *NewLength);
00087 
00088         //get the maximum size needed for a buffer
00089         DWORD MaxEncodeLength(DWORD Length);
00090         DWORD MaxDecodeLength(void *Buffer);
00091 
00092         //different settings that can be set
00093         deBoolean SetKey(void *KeyBuffer, long Bitsize);    //what key to use
00094         deBoolean SetIV(void *IVBuffer, long Length);       //what IV to use (used on CBC and CFB1)
00095         deBoolean SetMode(Mode CipherMode);                 //the type of encryption
00096         deBoolean SetRounds(int NumberRounds);              //number of rounds to do
00097 
00098     private:
00099         //struct is the size of a block for twofish, this is to allow for encryption
00100         //of the header without adding size
00101         typedef struct TwofishHeader
00102         {
00103             DWORD   ID;             //ID of the twofish data
00104             DWORD   OriginalSize;   //size of the original data
00105         } TwofishHeader;
00106 
00107         DWORD       priv_Key[8];    //stored key to use
00108         DWORD       priv_IV[4];     //stored IV to use
00109         int         priv_Rounds;    //number of rounds to do
00110         int         priv_KeySize;   //number of bits for the key
00111         Mode        priv_Cipher;    //type of encryption/decryption to do
00112 };
00113 
00114 class dePluginRijndael : public dePlugin, public IdePluginRijndael
00115 {
00116     public:
00117 
00118         //constructor/destructor
00119         dePluginRijndael();
00120         ~dePluginRijndael();
00121 
00122         //get the interface for a class
00123         void* GetInterface(IdePlugin::interface_t i);
00124 
00125         //release a plugin
00126         int Release();
00127 
00128         //the actual functions that do the work
00129         deBoolean EncodeData(void *Buffer, DWORD Length, void *NewBuffer, DWORD *NewLength);
00130         deBoolean DecodeData(void *Buffer, DWORD Length, void *NewBuffer, DWORD *NewLength);
00131 
00132         //get the maximum size needed for a buffer
00133         DWORD MaxEncodeLength(DWORD Length);
00134         DWORD MaxDecodeLength(void *Buffer);
00135 
00136         //different settings that can be set
00137         deBoolean SetKey(void *KeyBuffer, long Bitsize);    //what key to use
00138         deBoolean SetIV(void *IVBuffer, long Blocksize);    //IV to use
00139 
00140     private:
00141         typedef struct RijndaelHeader
00142         {
00143             DWORD   ID;             //ID of the rijndael data
00144             DWORD   OriginalSize;   //size of the original data
00145         } RijndaelHeader;
00146 
00147         //internal length verify function
00148         deBoolean ValidSize(int Size);
00149 
00150         DWORD       priv_Key[8];    //stored key to use
00151         DWORD       priv_IV[4];     //IV data
00152         int         priv_KeySize;   //number of bytes for the key
00153 };
00154 
00155 class dePluginZLib : public dePlugin, public IdePluginZLib
00156 {
00157     public:
00158         //constructor/destructor
00159         dePluginZLib();
00160         ~dePluginZLib();
00161 
00162         //get the interface for a class
00163         void* GetInterface(IdePlugin::interface_t i);
00164 
00165         //release a plugin
00166         int Release();
00167 
00168         //the actual functions that do the work
00169         deBoolean EncodeData(void *Buffer, DWORD Length, void *NewBuffer, DWORD *NewLength);
00170         deBoolean DecodeData(void *Buffer, DWORD Length, void *NewBuffer, DWORD *NewLength);
00171 
00172         //get the maximum size needed for a buffer
00173         DWORD MaxEncodeLength(DWORD Length);
00174         DWORD MaxDecodeLength(void *Buffer);
00175 
00176         //different settings that can be set
00177         deBoolean SetType(DataType Type);                   //the type of data to compress
00178         deBoolean SetCompressAmount(long Amount);           //how much to compress it (0-9)
00179 
00180     private:
00181         typedef struct ZLibHeader
00182         {
00183             DWORD   ID;             //ID of the zlib data
00184             DWORD   OriginalSize;   //size of the original data
00185         } ZLibHeader;
00186 
00187         DataType    priv_DataType;              //type of data we are compressing
00188         long        priv_CompressAmount;        //how much to compress by (0 to 9)  
00189 };
00190 
00191 class dePluginSHA1 : public dePlugin, public IdePluginSHA1
00192 {
00193     public:
00194 
00195         //constructor/destructor
00196         dePluginSHA1();
00197         ~dePluginSHA1();
00198 
00199         //get the interface for a class
00200         void* GetInterface(IdePlugin::interface_t i);
00201 
00202         //release a plugin
00203         int Release();
00204 
00205         //the actual functions that do the work
00206         deBoolean EncodeData(void *Buffer, DWORD Length, void *NewBuffer, DWORD *NewLength);
00207         deBoolean DecodeData(void *Buffer, DWORD Length, void *NewBuffer, DWORD *NewLength);
00208 
00209         //get the maximum size needed for a buffer
00210         DWORD MaxEncodeLength(DWORD Length);
00211         DWORD MaxDecodeLength(void *Buffer);
00212 
00213     private:
00214         typedef struct SHA1Header
00215         {
00216             DWORD   ID;             //ID of the sha1 data
00217             DWORD   OriginalSize;   //size of the original data
00218             BYTE    SHA1Hash[20];   //sha1 hash
00219         } SHA1Header;
00220 
00221         //internal length verify function
00222         deBoolean ValidSize(int Size);
00223 };
00224 
00225 #endif

Generated on Mon Sep 12 19:58:33 2005 for Destiny3D by doxygen1.3-rc3